//
//  JigSawStripSelectView.m
//  JigSawKiosk
//
//  Created by shaun on 10-11-03.
//  Copyright 2010 FruitonLabs. All rights reserved.
//

#import "JigSawStripSelectLayer.h"

extern int kNumberOfMovies ;

@implementation JigSawStripSelectLayer

@synthesize selectLayer1, selectLayer2, selectLayer3 ;


- (void) dealloc {

	[selectLayer1 release] ;
	[selectLayer2 release] ;
	[selectLayer3 release] ;
	
	[super dealloc] ;
}
	
	
	
- (id)initWithObj:(CGRect)frameSize {
    self = [super init];
    if (self) {
        // Initialization code here.
		self.bounds = frameSize ;
		//self.position = frameSize.origin ;
		[self setupLayers] ;
    }
    return self;
}


- (void) setupLayers {
	[self setMasksToBounds:YES];
	[self setBackgroundColor:CGColorCreateGenericGray(0.0, 0.0)] ;
	
	CGFloat buttonSize = [self bounds].size.height*0.45 ;
	if(kNumberOfMovies >= 1) {
		
	}
	if(kNumberOfMovies >= 4) {
		selectLayer1 = [[JigSawStripButtonLayer alloc] initWithObjects:buttonSize string:@"1-3"] ;
		[selectLayer1 setPosition:CGPointMake(buttonSize, [self bounds].size.height*0.5)] ;
		[self addSublayer:selectLayer1] ;
		
		selectLayer2 = [[JigSawStripButtonLayer alloc] initWithObjects:buttonSize string:@"4-6"] ;
		[selectLayer2 setPosition:CGPointMake([self bounds].size.width*0.5, [self bounds].size.height*0.5)] ;
		[self addSublayer:selectLayer2] ;
	}
	if(kNumberOfMovies == 9) {
		selectLayer3 = [[JigSawStripButtonLayer alloc] initWithObjects:buttonSize string:@"7-9"] ;
		[selectLayer3 setPosition:CGPointMake([self bounds].size.width-buttonSize, [self bounds].size.height*0.5)] ;
		[self addSublayer:selectLayer3] ;
	}
	
}


@end
